# frozen_string_literal: true

FactoryBot.define do
  sequence(:rule_output_seq_ordinal) { |n| n }
  sequence(:rule_condition_seq_name) { |n| "name_#{n}" }

  factory :rule_output do
    association :general_rule, factory: :rule_entity_general_rule_condition_any

    ordinal { generate :rule_output_seq_ordinal }
    name { generate :rule_condition_seq_name }
    # type { RuleOutput::Value }
    value { '123' }

    # type
    factory :rule_output_dsl, class: RuleOutput::Dsl.name do
      value { nil }

      after(:create) do |output|
        create :formula, formulable: output
      end
    end
    factory :rule_output_value, class: RuleOutput::Value.name do
      value { '11' }
    end
  end
end
